home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / LANG / C / LIB / DESK / CORE / Desk / h_doc / Pane2 < prev    next >
Text File  |  1996-05-21  |  10KB  |  246 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Pane2.h
  12.     Author:  Copyright © 1995 Andrew Sellors.
  13.     Version: 1.04 (4th August 1995)
  14.     Purpose: Handles windows with panes.
  15.     Mods:    1.02 -> 1.04
  16.              Added Desk_pane2_MAINRIGHT, Desk_Pane2_GetMainHandle, Desk_Pane2_GetPaneNumber, 
  17.              Desk_Pane2_OpenWindow, Desk_Pane2_ReadVars, Desk_Pane2_SetVars.
  18. */
  19. /*
  20.    NOTES:
  21.  
  22.    Desk_pane2_PANETOP   attaches the pane to the main window using the top left of the pane
  23.                    window rather than the bottom left corner.
  24.    Desk_pane2_MAINTOP   makes the pane move relative to the top of the main window rather than
  25.                    the bottom corner.
  26.    Desk_pane2_MAINRIGHT makes the pane move relative to the right of the main window rather
  27.                    than the left.
  28.    Desk_pane2_FIXED     forces the offset between the pane and the main windows to be constant,
  29.                    the pane is not allowed to move relative, with it off you get !ArtWork
  30.                    style pane windows.
  31.    Desk_pane2_HRESIZE   makes the right and side of the pane be cliped to the right hand side
  32.                    of the main window if the main window is smaller than the pane.
  33.    Desk_pane2_HSTRETCH  when used in conjunction with Desk_pane2_HRESIZE makes the right hand side
  34.                    of the pane always follow the right hand side of the main window.
  35.    Desk_pane2_VRESIZE   is like Desk_pane2_HREISZE except in the horizontal direction.
  36.    Desk_pane2_VSTRETCH  is like Desk_pane2_HSTRETCH except in the horizontal direction.
  37.    Desk_pane2_HSCROLL   makes the pane scroll with the main window in the horizontal direction.
  38.    Desk_pane2_VSCROLL   makes the pane scroll with the main window in the vertical direction.
  39.     
  40. */
  41.  
  42. #ifndef __Desk_Pane2_h
  43. #define __Desk_Pane2_h
  44.  
  45. #ifdef __cplusplus
  46.     extern "C" {
  47. #endif
  48.  
  49. #ifndef __Desk_WimpSWIs_h
  50.     #include "Desk.WimpSWIs.h"
  51. #endif
  52.  
  53. #ifndef __Desk_Window_h
  54.     #include "Desk.Window.h"
  55. #endif
  56.  
  57. #ifndef __Desk_Core_h
  58.     #include "Desk.Core.h"
  59. #endif
  60.  
  61. #ifndef __Desk_Wimp_h
  62.     #include "Desk.Wimp.h"
  63. #endif
  64.  
  65.  
  66. typedef union {
  67.     int value;
  68.     struct {
  69.       unsigned int panetop   :1; /* pane is linked using the top of the pane window */
  70.                                 /* else bottom is used */
  71.       unsigned int maintop   :1; /* pane is fixed to top of main else fixed to bottom */
  72.       unsigned int fixed     :1; /* pane cannot be moved relative to main window */
  73.       unsigned int hresize   :1; /* pane is resized to match width of main window up to */
  74.                                 /* pane width */
  75.       unsigned int hstretch  :1; /* pane width is ignored when resizing */
  76.       unsigned int vresize   :1; /* pane is resized to match height of main window up */
  77.                                 /* to pane height */
  78.       unsigned int vstretch  :1; /* pane height is ignored when resizing */
  79.       unsigned int hscroll   :1; /* pane scrolls horizontally with the main window */
  80.       unsigned int vscroll   :1; /* pane scrolls vertically with the main window */
  81.       unsigned int mainright :1; /* pane is fixed to right of main instead of left */
  82.       unsigned int dummy     :22;
  83.     } data;
  84. } Desk_pane2_flags;
  85.  
  86. #define Desk_pane2_PANETOP   0x0001
  87. #define Desk_pane2_MAINTOP   0x0002
  88. #define Desk_pane2_FIXED     0x0004
  89. #define Desk_pane2_HRESIZE   0x0008
  90. #define Desk_pane2_HSTRETCH  0x0010
  91. #define Desk_pane2_VRESIZE   0x0020
  92. #define Desk_pane2_VSTRETCH  0x0040
  93. #define Desk_pane2_HSCROLL   0x0080
  94. #define Desk_pane2_VSCROLL   0x0100
  95. #define Desk_pane2_MAINRIGHT 0x0200
  96.  
  97.  /*
  98.   * initialises 'mainwindow' with the library as a main window that can have
  99.   * panes attached to it.
  100.   */
  101. extern Desk_bool Desk_Pane2_AddMain(Desk_window_handle mainwindow);
  102.  
  103.  
  104.  /*
  105.   * Creates window as Desk_Window_Create and initialises it with the library as a
  106.   * main window that can have panes attached to it.
  107.   * The window handle is returned or 0 if window cannot be created.
  108.   */
  109. extern Desk_window_handle Desk_Pane2_CreateAndAddMain(const char *windowname, int maxtitlesize);
  110.  
  111.  
  112.  /*
  113.   * Adds the pane window 'panewindow' to the main window 'mainwindow'.
  114.   * If 'paneoffset' is not NULL then this is taken as the offset between the
  115.   * pane and the main window instead of the positions in the template.
  116.   * If 'panesize' is not NULL then this is taken as the size of the pane
  117.   * instead of the size in the template.
  118.   */
  119. extern Desk_bool Desk_Pane2_AddPane(Desk_window_handle mainwindow, Desk_window_handle panewindow,
  120.                           const Desk_wimp_point *paneoffset, const Desk_wimp_point *panesize, int flags);
  121.  
  122.  
  123.  /*
  124.   * Creates pane window as Desk_Window_Create and adds to the main window
  125.   * 'mainwindow'.
  126.   * If 'paneoffset' is not NULL then this is taken as the offset between the
  127.   * pane and the main window instead of the positions in the template.
  128.   * If 'panesize' is not NULL then this is taken as the size of the pane
  129.   * instead of the size in the template.
  130.   * The window handle is returned or 0 if window cannot be created.
  131.   */
  132. extern Desk_window_handle Desk_Pane2_CreateAndAddPane(const char *windowname, int maxtitlesize,
  133.                                             Desk_window_handle mainwindow,
  134.                                             const Desk_wimp_point *paneoffset,
  135.                                             const Desk_wimp_point *panesize,
  136.                                             int flags);
  137.  
  138.  
  139.  /*
  140.   * Opens the main window 'mainwindow' and all it's attached pane windows
  141.   * according to 'openpos'
  142.   * Use in the same manner to Desk_Window_Show
  143.   */
  144. extern void Desk_Pane2_Show(Desk_window_handle mainwindow, Desk_window_openpos openpos);
  145.  
  146.  
  147.  /*
  148.   * Closes the window 'mainwindow' (removes it from screen) and all it's panes
  149.   * Use in the same manner to Desk_Window_Hide
  150.   */
  151. extern void Desk_Pane2_Hide(Desk_window_handle mainwindow);
  152.  
  153.  
  154.  /*
  155.   * This hides and deletes the window 'mainwindow' and all it's panes
  156.   * Use in the same manner to Desk_Window_Delete
  157.   */
  158. extern void Desk_Pane2_Delete(Desk_window_handle mainwindow);
  159.  
  160.  
  161.  /*
  162.   * Calculates the pane offset and size so that the pane will be in the same
  163.   * position and size as the icon in the window.
  164.   * If 'panewindow' is the name of the pane window in the template file then the
  165.   * presence of any scroll bars or the window title bar is taken into accound
  166.   * when calculating the position and size of the pane, set it to NULL and no
  167.   * action is taken.
  168.   * Need to use Desk_pane2_MAINTOP and Desk_pane2_PANETOP flags.
  169.   */
  170. extern void Desk_Pane2_ReadIcon(Desk_window_handle window, Desk_icon_handle icon, const char *panewindow,
  171.                            Desk_wimp_point *paneoffset, Desk_wimp_point *panesize);
  172.  
  173.  /*
  174.   * Sets flags of 'panenumber'th pane attached to the window 'main' or NULL
  175.   * if the 'panenumber' is invalid.
  176.   * First pane is number 1.
  177.   * Returns flags and if 'flags' is -1 then they are left unchanged
  178.   */
  179. extern int Desk_Pane2_SetFlags(Desk_window_handle mainwindow, int panenumber, int flags);
  180.  
  181.  
  182.  /*
  183.   * Returns window handle of 'panenumber'th pane attached to the window 'main'
  184.   * or 0 if not found.
  185.   */
  186. extern Desk_window_handle Desk_Pane2_GetPaneHandle(Desk_window_handle mainwindow, int panenumber);
  187.  
  188.  
  189.  /*
  190.   * Returns window handle of main window which 'panewindow' is attached to
  191.   * or 0 if not found.
  192.   */
  193. extern Desk_window_handle Desk_Pane2_GetMainHandle(Desk_window_handle panewindow);
  194.  
  195.  
  196.  /*
  197.   * Returns pane number of 'panewindow' attatched to 'mainwindow' or 0 if the
  198.   * window was not found.
  199.   */
  200. extern int Desk_Pane2_GetPaneNumber(Desk_window_handle mainwindow, Desk_window_handle panewindow);
  201.  
  202.  
  203.  /*
  204.   * This hides and deletes the 'panenumber'th pane attached to the window
  205.   * 'mainwindow' 
  206.   */
  207. extern void Desk_Pane2_DeletePane(Desk_window_handle mainwindow, int panenumber);
  208.  
  209.  
  210.  /*
  211.   * Calls Desk_Wimp_OpenWindow for the mainwindow and all its panes as if it was
  212.   * send an openwindow request.
  213.   * If 'openblock' is NULL then the current state of the main window is used.
  214.   * Supplying an openblock allows the main window to be changed and the panes to be
  215.   * altered to match.
  216.   * Can be used to make a pane window appear that has been added to an open mainwindow.
  217.   */
  218. extern Desk_bool Desk_Pane2_OpenWindow(Desk_window_handle mainwindow, const Desk_window_openblock *openblock);
  219.  
  220.  
  221.  /*
  222.   * Returns paneoffset if 'paneoffset' is not NULL and panesize if 'panesize' is
  223.   * not NULL for the 'panenumber'th pane attatched to 'mainwindow'.
  224.   * Desk_bool_TRUE is returned for success.
  225.   */
  226. extern Desk_bool Desk_Pane2_ReadVars(Desk_window_handle mainwindow, int panenumber,
  227.                            Desk_wimp_point *paneoffset, Desk_wimp_point *panesize);
  228.  
  229.  
  230.  /*
  231.   * Sets paneoffset if 'paneoffset' is not NULL and panesize if 'panesize' is
  232.   * not NULL for the 'panenumber'th pane attatched to 'mainwindow'.
  233.   * Desk_bool_TRUE is returned for success.
  234.   * After changing the variables, Desk_Pane2_OpenWindow must be used to make the
  235.   * windows on screen exhibit the changes.
  236.   */
  237. extern Desk_bool Desk_Pane2_SetVars(Desk_window_handle mainwindow, int panenumber,
  238.                            const Desk_wimp_point *paneoffset, const Desk_wimp_point *panesize);
  239.  
  240. #ifdef __cplusplus
  241. }
  242. #endif
  243.  
  244.  
  245. #endif
  246.